<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品详情页</title>
    <link rel="stylesheet" type="text/css" href="/static/css/detail.css">
    <link rel="stylesheet" type="text/css" href="/static/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/static/css/index.css">
</head>
<body>



<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到天天商城!</div>
			<div class="fr">
				<div class="login_btn fl">
					<a href="{{ url_for('user.login')}}">登录</a>
					<span>|</span>
					<a href="{{ url_for('user.register')}}">注册</a>
				</div>
				<div class="user_link fl">
                    	<span>|</span>
                    <a href="{{ url_for('index') }}">首页</a>
                    <span>|</span>
					<a href="{{ url_for('user.main')}}">用户中心</a>
					<span>|</span>
					<a href="{{ url_for('user.showCart')}}">我的购物车</a>
				</div>
			</div>
		</div>
	</div>



<div class="page container" style="margin-top: 100px" >
<form  id="proForm" name="proform"action="{{ url_for('product.addCart',id=product['id']) }}" method="post">

 <div class="product_image fl" >
 <img class="image" src="{{ product.images }}" alt="未加载成功...">
 </div>

 <div class="product_info fl">
  <p style="font-size: 20px">{{ product.pname }}</p>
     <br><br><br>
  <div class="prize">单价：￥{{ product.price }}</div>
     <br>
 <p style="font-size: 18px">数量：
<select name="number" class="num">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
</select>
     </p>
     <br><br><br><br><br><br><br><br>
     {% if session.get('uid') %}
 <button class="add_cart" id="add_cart" type="submit" onclick="myFunction()">加入购物车</button>
         {% else %}
         <p>快快登录将宝贝加入购物车中吧~</p>
     {% endif %}
 </div>

</form>
</div>
<script>
function myFunction() {


   {#var n=$(".num").val();#}
   {#  $.ajax({#}
   {#     type:'post',#}
   {#     url:'{{ url_for('product.addCart',id=product['id']) }}',#}
   {#     data:JSON.stringify({'number':n}),#}
   {#      async: true,#}
   {#       contentType: "application/json",#}
   {#     dataType:'json',#}
   {#     success:function(data){#}
   {#         if(data){#}
   {#             alert("你已经成功将宝贝加入购物车，请继续购物吧~");#}
   {#         }#}
   {#     }#}
   {# });#}




  alert("成功将宝贝加入购物车，继续购物吧~");
  return true
}
</script>
</body>
</html>